From: Sergio Costas Date: Thu, 24 Jan 2019 22:06:48 +0000 (+0100) Subject: windowManager: detect change to a non-existent WS X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~897^2^2~129 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=d75a3484d664139b5e8c8acc9818eb475e8d672e;p=gnome-shell.git windowManager: detect change to a non-existent WS When using dynamic workspaces, it is possible to try to change to a non-existent one if the user defines hotkeys for changing to desktop 1, 2, 3... This case is not detected, and gnome shell shows an error: JS ERROR: TypeError: workspace is null actionMoveWorkspace@resource:///org/gnome/shell/ui/windowManager.js:2130:13 wrapper@resource:///org/gnome/gjs/modules/_legacy.js:82:22 _showWorkspaceSwitcher@resource:///org/gnome/shell/ui/windowManager.js:2104:13 wrapper@resource:///org/gnome/gjs/modules/_legacy.js:82:22 This patch adds a check before trying to change the workspace, to avoid switching to a non-existent one. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/365 --- diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index fedee72d5..a8b4f8e69 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -2086,7 +2086,7 @@ var WindowManager = new Lang.Class({ direction = Meta.MotionDirection[target.toUpperCase()]; newWs = workspaceManager.get_active_workspace().get_neighbor(direction); - } else if (target > 0) { + } else if ((target > 0) && (target <= workspaceManager.n_workspaces)) { target--; newWs = workspaceManager.get_workspace_by_index(target);